#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    while (n--) {
        string name;
        int breath, pulse;
        cin >> name >> breath >> pulse;
        if (breath > 20 || breath < 15 || pulse > 70 || pulse < 50) cout << name << endl;
    }
    return 0;
}